<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";

%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>学生个人信息</title>
    <script src="<%=basePath%>/js/jquery-3.2.1.min.js"></script>
    <script src="<%=basePath%>/js/vue.min.js"></script>
    <link rel="stylesheet" href="<%=basePath%>/layui/css/layui.css" media="all">
    <script src="<%=basePath%>/layui/css/layui.css" charset="utf-8"></script>
</head>
<body>
<div class="site-text site-block" style="margin-top:50px">

    <form id="aform" name="aform" class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">学号</label>
            <div class="layui-input-block">
                <input id="sno" value="${sessionScope.student.sno}" disabled="disabled" type="text" name="sno" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <input id="sname" value="${sessionScope.student.sname}" disabled="disabled" type="text"  name="sname" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input id="sex" value="${sessionScope.student.sex}" disabled="disabled" type="text" name="sex" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">院系</label>
            <div class="layui-input-block">
                <input id="sDepartment" value="${sessionScope.student.sDepartment}" disabled="disabled" type="sDepartment" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">专业</label>
            <div class="layui-input-block">
                <input id="sClass" value="${sessionScope.student.sClass}" disabled="disabled" type="text" name="sClass" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
                <input id="email" value="${sessionScope.student.email}" type="text" name="email" required="" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">电话</label>
            <div class="layui-input-block">
                <input id="sPhone" value="${sessionScope.student.sPhone}" type="text" name="sPhone" required="" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">原密码</label>
            <div class="layui-input-inline">
                <input id="oldPsw" type="password" name="oldPsw" required="" lay-verify="required" lay-vertype="tips" placeholder="请输入原密码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">新密码</label>
            <div class="layui-input-inline">
                <input id="psw1" onchange="checkpwd()" type="password" name="psw1" required="" lay-verify="required" lay-vertype="tips" placeholder="请输入新密码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-inline">
                <input id="psw2" onchange="checkpwd()" type="password" name="psw2" required="" lay-verify="required" lay-vertype="tips" placeholder="请再次输入新密码" autocomplete="off" class="layui-input">
                <div id="msg" style="color:red;"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button id="btn" class="layui-btn btn-submit" lay-filter="reg" lay-submit="">修改</button>
            </div>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">
    function checkpwd(){
        var p1=window.document.aform.psw1.value;//获取密码框的值
        var p2=window.document.aform.psw2.value;//获取重新输入的密码值

        if(p1!=p2){//判断两次输入的值是否一致，不一致则显示错误信息
            window.document.getElementById("msg").innerHTML="两次输入密码不一致，请重新输入";//在div显示错误信息
        }else{
            window.document.getElementById("msg").innerHTML="";
        }
    }

    $('#btn').click(function(){
        var param = {};
        param.sDepartment = window.document.getElementById("sDepartment").value;
        param.sClass = window.document.getElementById("sClass").value;
        // param.tObject = window.document.getElementById("tObject").value;
        // param.tDegree = window.document.getElementById("tDegree").value;
        // param.tJobs = window.document.getElementById("tJobs").value;
        // param.cDirection = window.document.getElementById("cDirection").value;
        param.email = window.document.getElementById("email").value;
        // param.tAddress = window.document.getElementById("tAddress").value;
        param.sPhone = window.document.getElementById("sPhone").value;
        param.oldPsw = window.document.getElementById("oldPsw").value;
        param.psw1 = window.document.getElementById("psw1").value;
        param.psw2 = window.document.getElementById("psw2").value;


        $.ajax({
            cache:true,
            type:"POST",
            url:"/bysjxksys/teacher/editTeacher_info",//这是我在后台接受数据的文件名
            data:param
        })
    });

</script>

</html>



